<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>产品信息</title>
		<link rel="stylesheet" type="text/css" href="../css/supplyProceOrserStyle.css" />
		<script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
		<script src="../js/deom.js" type="text/javascript" charset="utf-8"></script>
		<meta name="viewport" content=" height=device-height,
			          width=device-width,
			          initial-scale=1.0,
			          minimum-scale=1.0,
			          maximum-scale=1.0,
			          user-scalable=no" />
		<script type="text/javascript">
			$(function() {
				var userId = localStorage.getItem("userId");
				var proId = localStorage.getItem("proId");
				var token = localStorage.getItem("token");
				var ip = localStorage.getItem("ip");
				var imagePath = [];
				$.ajax({
					type: 'post', //类型
					url: ip + 'product/suppdetails', //请求路径
					contentType: 'application/x-www-form-urlencoded', //默认
					dataType: 'json', //返回数据类型  可以是text：字符串  可以是json：json对象
					data: {
						'proId': proId,
						'userId': userId,
						'token': token,
					}, //数据
					success: function(result) {
						if(result.code == 200) {
							var txts = '';
							for(var Key in result.data.projectImgVo) {
								var imagePath = result.data.projectImgVo[Key].imagePath;
								if(imagePath == null) {
									imagePath = 'http://39.108.187.126:8080/nop.png';
								}
								txts = txts + '<a class="ig" onclick=' + 'getimgs(' + '"' + imagePath + '"' + ');>';
								txts = txts + '<img id="igs" class="imgs" src="' + imagePath + '"/></a>';
							}
							$(".igclass").append(txts);
							var protit = result.data.proName + result.data.proType + result.data.proModel;
							document.getElementById('title').value = protit;
							localStorage.setItem("Name", result.data.proName);
							localStorage.setItem("Type", result.data.proType);
							localStorage.setItem("Model", result.data.proModel);
							var unitPrice = result.data.unitPrice;
							document.getElementById('unitPrice').innerText = unitPrice;
							localStorage.setItem("unitP", result.data.unitPrice);
							var taxPrice = result.data.taxPrice;
							document.getElementById('taxPrice').innerText = taxPrice;
							localStorage.setItem("taxP", result.data.taxPrice);
							var proSellerNum = result.data.proSellerNum;
							document.getElementById('proSellerNum').innerText = proSellerNum;
							localStorage.setItem("SellerNum", result.data.proSellerNum);
							var proDescribe = result.data.proDescribe;
							document.getElementById('proDescribe').innerText = proDescribe;
							var productBom = '';
							for(var Key in result.data.productBom) {
								productBom = result.data.productBom[Key].bomName + result.data.productBom[Key].onceNum;
								productBom = productBom + result.data.productBom[Key].unit + '；';
							}
							document.getElementById('productBom').innerText = productBom;
							var sum = [];
							var unm = [];
							var id = [];
							for(var Key in result.data.productBom) {
								id[Key] = result.data.productBom[Key].id;
								sum[Key] = result.data.productBom[Key].bomId;
								unm[Key] = result.data.productBom[Key].onceNum;
							}
							var ids = JSON.stringify(id);
							localStorage.setItem("ids", ids);
							var sums = JSON.stringify(sum);
							localStorage.setItem("sums", sums);
							var unms = JSON.stringify(unm);
							localStorage.setItem("unms", unms);
						} else {
							alert('获取数据异常,请重新登录');
							//window.location.href = 'Login.html';
						}
					},
					error: function(data) { //若果传过来的数据为空
					}
				});
			});

			function getimgs(imagePath) {
				window.open(imagePath);
			}

			function getsupplyProceModify() {
				localStorage.setItem("myfiles", document.getElementById('igs').src);
				localStorage.setItem("unitPrice", localStorage.getItem("unitP"));
				localStorage.setItem("taxPrice", localStorage.getItem("taxP"));
				localStorage.setItem("proName", localStorage.getItem("Name"));
				localStorage.setItem("proType", localStorage.getItem("Type"));
				localStorage.setItem("proModel", localStorage.getItem("Model"));
				localStorage.setItem("proSellerNum", localStorage.getItem("SellerNum"));
				localStorage.setItem("proDescribe", document.getElementById('proDescribe').value);
				window.location.href = 'supplyProceModify.html';
			}
		</script>
	</head>

	<body>
		<div id="igs" class="igclass">
		</div>
		<div class="btn btn1">
			<</div>
				<div class="btn btn2">></div>
				<textarea id="title" class="pro_tit">产品名称+产品类型+产品型号</textarea>
				<div class="pro_much">
					<label>价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格:</label>
					<font id="unitPrice">价格</font><br /><br />
					<label>含&nbsp;&nbsp;税&nbsp;价:</label>
					<font id="taxPrice">含税价</font>
				</div>
				<div class="pro_info">
					<label>产品编号:</label>
					<font id="proSellerNum">产品编号</font>
				</div>
				<div class="pro_info">
					<label>产品描述:</label>
					<textarea id="proDescribe" style="margin-left: 20%; width: 70%;height:50px;border:none;background: #EEEEEE;">产品描述</textarea>
				</div>
				<div class="pro_info">
					<label>生产物料:</label>
					<textarea id="productBom" style="margin-left: 20%; width: 70%; height:50px;border:none; background: #EEEEEE;">生产物料</textarea>
				</div>
				<font class="div-but-submit" onclick="getsupplyProceModify()">修改信息</font>
	</body>

</html>